﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ForzaGT3.Data
{
    public partial class Country
    {
        public void Insert()
        {
            DataRepositoryFactory.CurrentRepository
                .Create<Country>(this);
        }

        public void Update()
        {
            DataRepositoryFactory.CurrentRepository
                .Modify<Country>(this);
        }

        public void Delete()
        {
            DataRepositoryFactory.CurrentRepository
                .Delete<Country>(this);
        }

        public static Country GetById(Guid Id)
        {
            return DataRepositoryFactory.CurrentRepository
                .Single<Country>(x => x.CountryId == Id);
        }

        public static IEnumerable<Country> GetAll()
        {
            return DataRepositoryFactory.CurrentRepository
                .Find<Country>(x=>x.IsDeleted == false);
        }
    }
}
